﻿using System;

namespace LearnVirtual
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            Father f = new Father();
            f.DoSomething();//输出 Father.Work

            Son s = new Son();
            s.DoSomething();//输出 Son.Learn

            Father fs = new Son();
            fs.DoSomething();//输出 Father.Learn

            Console.ReadLine();
        }
    }

    class Father
    {
        public virtual void DoSomething()
        {
            Console.WriteLine($"{nameof(Father)}.Work");
        }
    }

    class Son : Father
    {
        public new void DoSomething()
        {
            Console.WriteLine($"{nameof(Son)}.Learn");
        }
    }

    class Daughter : Father
    {

    }
}
